package kr.co.thornbacksoft.mrnom;

import java.util.Random;

public class Enemy {
	static final int DIRECTION_LEFT = 0;
	static final int DIRECTION_UP = 1;
	static final int DIRECTION_RIGHT = 2;
	static final int DIRECTION_DOWN = 3;
	public int x;
	public int y;
	Random random = new Random();

	public Enemy() {
		x = random.nextInt(World.WORLD_WIDTH);
		y = random.nextInt(World.WORLD_HEIGHT);
	}

	public void advanced() {
		int direction = random.nextInt(4);

		if (direction == DIRECTION_LEFT) {
			x--;

			if (x < 0)
				x = World.WORLD_WIDTH - 1;
		} else if (direction == DIRECTION_UP) {
			y--;

			if (y < 0)
				y = World.WORLD_HEIGHT - 1;
		} else if (direction == DIRECTION_RIGHT) {
			x++;

			if (x > World.WORLD_WIDTH - 1)
				x = 0;
		} else if (direction == DIRECTION_DOWN) {
			y++;

			if (y > World.WORLD_HEIGHT - 1)
				y = 0;
		}
	}
}
